<?php
	//引入配置文件和数据库操作函数
	require '../../public/config.php';
	require '../../public/mysql.php';
	require '../../public/function.php';
	//连接数据库
	$link = connect();
	//准备sql和执行sql
	$sql = "select * from category";
	if ($link['error']) {
		$result = query($link['mess'], $sql);
	}
	
	$cates = getTree($result, 0);
	//var_dump($cates);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>S54商城中心 - 分类列表 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../include/Css/general.css" rel="stylesheet" type="text/css" />
<link href="../include/Css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
    <span class="action-span"><a href="./cateAdd.php">添加分类</a></span>
    <span class="action-span1"><a href="__GROUP__">S54商城中心</a></span>
    <span id="search_id" class="action-span1"> - 分类列表 </span>
    <div style="clear:both"></div>
</h1>
<div class="form-div">
    <form action="./userList.php" name="searchForm">
        <img src="../include/Images/icon_search.gif" width="26" height="22" border="0" alt="search" />
        <!-- 关键字 -->
        用户名： <input type="text" name="username" size="15" />
        <input type="submit" value=" 搜索 " class="button" />
    </form>
</div>

<!-- 商品列表 -->
<form method="post" action="" name="listForm" onsubmit="">
    <div class="list-div" id="listDiv">
        <table cellpadding="3" cellspacing="1">
            <tr>
                <th>ID</th>
                <th>分类名</th>
                <th>父ID</th>
                <th>操作</th>
            </tr>
			<?php foreach ($cates as $val) :?>
            <tr>
                <td align="center"><?php echo $val['id']?></td>
                <td align="left" class="first-cell"><span><?php echo str_repeat('&nbsp', $val['count'] * 8).'|--'.$val['name'];?></span></td>
                <td align="center"><span onclick=""><?php echo $val['pid'];?></span></td>
                <td align="center">
                <a href="resetPass.php?id=<?php echo $val['id']?>" target="" title="密码重置"><img src="../include/Images/icon_view.gif" width="16" height="16" border="0" /></a>
                <a href="./cateEdit.php?id=<?php echo $val['id']?>" title="编辑"><img src="../include/Images/icon_edit.gif" width="16" height="16" border="0" /></a>
                <a href="./action.php?a=del&id=<?php echo $val['id']?>" onclick="" title="删除"><img src="../include/Images/icon_trash.gif" width="16" height="16" border="0" /></a></td>
            </tr>
			<?php endforeach;?>
        </table>

    <!-- 分页开始 -->
        <table id="page-table" cellspacing="0">
            <tr>
                <td width="80%">&nbsp;</td>
                <td align="center" nowrap="true">
                </td>
            </tr>
        </table>
    <!-- 分页结束 -->
    </div>
</form>

<div id="footer">
共执行 7 个查询，用时 0.028849 秒，Gzip 已禁用，内存占用 3.219 MB<br />
版权所有 &copy; 2005-2012 暴走少年哈尔，并保留所有权利。</div>
</body>
</html>